package com.tingfeng.demo02;

public class UserServiceProxy implements UserService{

    private UserServiceImpl userService;

    // 这里关键 设置了set方法 可传入userServiceImpl
    public void setUserService(UserServiceImpl userService) {
        this.userService = userService;
    }

    @Override
    public void add() {
        log("add");
        userService.add();
    }

    @Override
    public void del() {
        log("del");
        userService.del();
    }

    @Override
    public void update() {
        log("update");
        userService.update();
    }

    @Override
    public void query() {
        log("query");
        userService.query();
    }

    public void log(String msg){
        System.out.println("该方法为"+msg);
    }
}
